/*********************************************************************
*                SEGGER MICROCONTROLLER GmbH & Co. KG                *
*        Solutions for real time microcontroller applications        *
**********************************************************************
*                                                                    *
*        (c) 2003-2011     SEGGER Microcontroller GmbH & Co KG       *
*                                                                    *
*        Internet: www.segger.com    Support:  support@segger.com    *
*                                                                    *
**********************************************************************

----------------------------------------------------------------------
File        : FS_Weak.c
Purpose     : Weak dummy functions to compile samples with KEIL MDK which do not use FS.
----------------------------------------------------------------------
Known problems or limitations with current version
----------------------------------------------------------------------
None.
---------------------------END-OF-HEADER------------------------------
*/

/*********************************************************************
*
*       #include Section
*
**********************************************************************
*/

#include "FS.h"
#include "IDE_X_HW.h"
#include "MMC_X_HW.h"
#include "MMC_MCI_HW.h"
#include "MMC_SD_CardMode_X_HW.h"
#include "FS_DF_X_HW.h"
#include "NAND_X_HW.h"

/*********************************************************************
*
*       #define Macros
*
**********************************************************************
*/
#define MMC_DEFAULTSUPPLYVOLTAGE  3300 /* in mV, example means 3.3V */
#define MCI_MCLK                  100024589uL

/*********************************************************************
*
*       Static data
*
**********************************************************************
*/

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       FS_IDE_HW_ReadReg
*
*   Description:
*     Reads an IDE register. Data from the IDE register are read 16-bit wide.
* 
*   Parameters:
*     Unit       - Unit number.
*     AddrOff    - Address offset that specifies which IDE register should be read
*  
*   Return value:
*     Data read from the IDE register.
*/
__weak U16 FS_IDE_HW_ReadReg(U8 Unit, unsigned AddrOff) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(AddrOff);
  return 0;
}

/*********************************************************************
*
*       FS_IDE_HW_WriteReg
*
*   Description:
*     Write an IDE register. Data to the IDE register are written 16-bit wide.
* 
*   Parameters:
*     Unit       - Unit number.
*     AddrOff    - Address offset that specifies which IDE register should be written
*  
*   Return value:
*     ==1         - Device is connected.
*     ==0         - Device is not connected.
*/
__weak void FS_IDE_HW_WriteReg(U8 Unit, unsigned AddrOff, U16 Data) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(AddrOff);
  FS_USE_PARA(Data);
}

/*********************************************************************
*
*       FS_IDE_HW_ReadData
*
*   Description:
*     Reads data from the IDE data register.
* 
*   Parameters:
*     Unit       - Unit number.
*     AddrOff    - Address offset that specifies which IDE register should be read
*     pData      - Pointer to a read buffer
*     NumBytes   - Number of bytes that should be read.
*  
*   Return value:
*     ==1         - Device is connected.
*     ==0         - Device is not connected.
*/
__weak void FS_IDE_HW_ReadData(U8 Unit, U8 * pData, unsigned NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_IDE_HW_WriteData
*
*   Description:
*     Writes data to the IDE data register.
* 
*   Parameters:
*     AddrOff    - Address offset that specifies which IDE register should be read
*     pData      - Pointer to a read buffer
*     NumBytes   - Number of bytes that should be read.
*  
*   Return value:
*     ==1         - Device is connected.
*     ==0         - Device is not connected.
*/
__weak void FS_IDE_HW_WriteData(U8 Unit, const U8 * pData, unsigned NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_IDE_HW_IsPresent
*
*   Description:
*     FS driver hardware layer function. Check if the device is present.
* 
*   Parameters:
*     Unit        - Unit number.
*  
*   Return value:
*    FS_MEDIA_STATE_UNKNOWN if the state of the media is unknown.
*    FS_MEDIA_NOT_PRESENT   if no card is present.
*    FS_MEDIA_IS_PRESENT    if a card is present.
*/
__weak int FS_IDE_HW_IsPresent(U8 Unit) {
  FS_USE_PARA(Unit);
  return FS_MEDIA_IS_PRESENT;
}


/*********************************************************************
*
*       FS_IDE_HW_X_HWReset
*
*   Description:
*     FS driver hardware layer function. This function is called, when 
*     the driver detects a new media is present. For ATA HD drives, there 
*     is no action required and this function can be empty.
* 
*   Parameters:
*     Unit        - Unit number.
*   Return value:
*     None.
*/

__weak void FS_IDE_HW_Reset(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_IDE_HW_X_Delay400ns
*
*  Description:
*    This function is called whenever a delay of 400 ns is required.
*    After sending a command or sending the parameter to the integrated
*    controller on the IDE/CF drive. Slow cards need a delay of 400ns.
*    New drives are quite fast enough, so that a delay may not be
*    required. So this function can be empty.
*
*  Parameters:
*  Unit        - Unit number.
* 
*  Return value:
*  None.
*/
__weak void FS_IDE_HW_Delay400ns(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_MCI_HW_IsCardPresent
*
*  Function description:
*    Returns whether a card is inserted or not.
*    When a card detect pin is not available. The function shall return
*    FS_MEDIA_STATE_UNKNOWN. The driver above will check, whether there
*    a valid card
*
*  Parameters:
*    Unit    - MCI Card unit that shall be used
*  
*  Return value:
*    FS_MEDIA_STATE_UNKNOWN  - Card state is unknown, since no card detect pin available
*    FS_MEDIA_NOT_PRESENT    - No Card is inserted in slot.
*    FS_MEDIA_IS_PRESENT     - Card is inserted in slot.
*/
int FS_MCI_HW_IsCardPresent(U8 Unit) {
  FS_USE_PARA(Unit);
  return FS_MEDIA_IS_PRESENT;
}

/*********************************************************************
*
*       FS_MCI_HW_IsCardWriteProtected
*
*  Function description:
*    Checks whether a card is write protected or not.
*
*  Parameters:
*    Unit    - MCI Card unit that shall be used
*  
*  Return value:
*    0       - Card is not write protected.
*    1       - Card is     write protected.
*
*/
U8 FS_MCI_HW_IsCardWriteProtected(U8 Unit) {
  FS_USE_PARA(Unit);
  return 0;
}

/*********************************************************************
*
*       FS_MCI_HW_GetMClk
*
*  Function description:
*    The internal MCLK that was configured shall be returned.
*
*  Parameters:
*    Unit    - MCI Card unit that shall be used
*  
*  Return value:
*    The master clock (MCLK) given in Hz.
*
*/
U32 FS_MCI_HW_GetMClk(U8 Unit) {
  FS_USE_PARA(Unit);
  return MCI_MCLK;
}

/*********************************************************************
*
*       FS_MCI_HW_Init
*
*  Function description:
*    This function shall initialize all necessary hardware modules
*    that depend on the MCI.
*    In normal cases PIO configuration needs to be done.
*
*  Parameters:
*    Unit    - MCI Card unit that shall be used
*  
*/
void FS_MCI_HW_Init(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_MCI_HW_EnableClock
*
*  Function description:
*    This function shall enable or disable the master clock of the 
*    MCI module. This is done by setting the appropiate bit in the
*    PMC_PCER/PMC_PCDR register.
*
*  Parameters:
*    Unit    - MCI Card unit that shall be used
*    OnOff   - 1 - Enable the clock
*              0 - Disable the clock
*  
*/
void FS_MCI_HW_EnableClock(U8 Unit, unsigned OnOff) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(OnOff);
}

/*********************************************************************
*
*       FS_MCI_HW_GetMCIInfo
*
*  Function description:
*    This function is used to get base address of the MCI module 
*    and which MCI slot shall be used.
*
*  Parameters:
*    Unit    - MCI Card unit that shall be used
*    pInfo   - Pointer a MCI_INFO structure that shall be filled
*              by this function.
*  
*/
void FS_MCI_HW_GetMCIInfo(U8 Unit, MCI_INFO * pInfo) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pInfo);
}

/*********************************************************************
*
*       FS_MCI_HW_EnableISR
*
*  Function description:
*    The function is called during initialization to install the
*    ISR handler of the MCI module.
*
*  Parameters:
*    Unit         - MCI Card unit that shall be used
*    pISRHandler  - Pointer to the ISR handler that shall be installed.
*  
*/
void FS_MCI_HW_EnableISR(U8 Unit, ISR_FUNC * pISRHandler) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pISRHandler);
}

/*********************************************************************
*
*       FS_MCI_HW_InvalidateDCache
*
*  Function description:
*    This function is called after a DMA transfer was made from card 
*    to the memory. This will ensure that the internal CPU cache 
*    is informed that the cache information are invalid.
*    When cache is not used the function can be empty.
*
*  Parameters:
*    p          - Pointer to the buffer that shall be invalidated in cache.
*    NumBytes   - Number of bytes to invalidate
*  
*/
void FS_MCI_HW_InvalidateDCache(void * p, unsigned NumBytes) {
  FS_USE_PARA(p);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_MCI_HW_CleanDCacheRange
*
*  Function description:
*    Before data are transferred from the memory to the card, we need 
*    to flush the internal CPU cache in order to have correct value,
*    that are stored in the internal cache.
*    This function can also be empty when cache is not used.
*
*  Parameters:
*    p          - Pointer to the region that shall be flushed from cache.
*    NumBytes   - Number of bytes to flush
*  
*/
void FS_MCI_HW_CleanDCacheRange(void * p, unsigned NumBytes) {
  FS_USE_PARA(p);
  FS_USE_PARA(NumBytes);
}

/**********************************************************
*
*       FS_MMC_HW_X_SetHWNumBlocks
*
*/
__weak void FS_MMC_HW_X_SetHWNumBlocks(U8 Unit, U16 NumBlocks) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(NumBlocks);
}

/**********************************************************
*
*       FS_MMC_HW_X_SetHWBlockLen
*
*/
__weak void FS_MMC_HW_X_SetHWBlockLen(U8 Unit, U16 BlockSize) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(BlockSize);
}

/**********************************************************
*
*       FS_MMC_HW_X_SetResponseTimeOut
*
*/
__weak void FS_MMC_HW_X_SetResponseTimeOut(U8 Unit, U32 Value) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(Value);
}

/**********************************************************
*
*       FS_MMC_HW_X_SetReadDataTimeOut
*
*/
__weak void FS_MMC_HW_X_SetReadDataTimeOut(U8 Unit, U32 Value) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(Value);
}

/**********************************************************
*
*       FS_MMC_HW_X_SendCmd
*/
__weak void FS_MMC_HW_X_SendCmd(U8 Unit, unsigned Cmd, unsigned CmdFlags, unsigned ResponseType, U32 Arg) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(Cmd);
  FS_USE_PARA(CmdFlags);
  FS_USE_PARA(ResponseType);
  FS_USE_PARA(Arg);
}

/**********************************************************
*
*       FS_MMC_HW_X_GetResponse
*/
__weak int FS_MMC_HW_X_GetResponse(U8 Unit, void *pBuffer, U32 Size) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pBuffer);
  FS_USE_PARA(Size);
  return 0;
}

/**********************************************************
*
*       FS_MMC_HW_X_ReadData
*/
__weak int FS_MMC_HW_X_ReadData (U8 Unit, void * pBuffer, unsigned NumBytes, unsigned NumBlocks) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pBuffer);
  FS_USE_PARA(NumBytes);
  FS_USE_PARA(NumBlocks);
  return 0;
}

/**********************************************************
*
*       FS_MMC_HW_X_WriteData
*/
__weak int FS_MMC_HW_X_WriteData(U8 Unit, const void * pBuffer, unsigned NumBytes, unsigned NumBlocks) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pBuffer);
  FS_USE_PARA(NumBytes);
  FS_USE_PARA(NumBlocks);
  return 0;
}

/**********************************************************
*
*       FS_MMC_HW_X_Delay
*/
__weak void FS_MMC_HW_X_Delay(int ms) {
  FS_USE_PARA(ms);
}

/**********************************************************
*
*       FS_MMC_HW_X_InitHW
*/
__weak void FS_MMC_HW_X_InitHW(U8 Unit) {
  FS_USE_PARA(Unit);
}


/*********************************************************************
*
*       FS_MMC_HW_X_IsPresent
*
*  Description:
*    Returns the state of the media. If you do not know the state, return
*    FS_MEDIA_STATE_UNKNOWN and the higher layer will try to figure out if
*    a media is present.
*
*  Parameters:
*    Unit                 - Device Index
*
*  Return value:
*    FS_MEDIA_STATE_UNKNOWN    - Media state is unknown
*    FS_MEDIA_NOT_PRESENT      - Media is not present
*    FS_MEDIA_IS_PRESENT       - Media is present
*/
__weak int FS_MMC_HW_X_IsPresent(U8 Unit) {
  FS_USE_PARA(Unit);
  return FS_MEDIA_IS_PRESENT;
}

#if FS_VERSION < 32100UL
/**********************************************************
*
*       FS_MMC_HW_X_GetMaxReadBurst
*/
__weak U16 FS_MMC_HW_X_GetMaxReadBurst(U8 Unit) {
  FS_USE_PARA(Unit);
  return 0xffff;
}

/**********************************************************
*
*       FS_MMC_HW_X_GetMaxWriteBurst
*/
__weak U16 FS_MMC_HW_X_GetMaxWriteBurst(U8 Unit) {
  FS_USE_PARA(Unit);
  return 0xffff;
}
#else
/**********************************************************
*
*       FS_MMC_HW_X_GetMaxReadBurst
*/
__weak U16 FS_MMC_HW_X_GetMaxReadBurst(U8 Unit) {
  FS_USE_PARA(Unit);
  return 1;
}

/**********************************************************
*
*       FS_MMC_HW_X_GetMaxWriteBurst
*/
__weak U16 FS_MMC_HW_X_GetMaxWriteBurst(U8 Unit) {
  FS_USE_PARA(Unit);
  return 1;
}
#endif

/*********************************************************************
*
*       FS_MMC_HW_X_EnableCS
*
*  Description:
*    FS low level function. Sets the card slot active using the
*    chip select (CS) line.
*
*  Parameters:
*    Unit      - Device Index
*
*  Return value:
*    void
*/
__weak void FS_MMC_HW_X_EnableCS(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_MMC_HW_X_DisableCS
*
*  Description:
*    FS low level function. Clears the card slot inactive using the
*    chip select (CS) line.
*
*  Parameters:
*    Unit      - Device Index
*
*  Return value:
*    void
*/
__weak void FS_MMC_HW_X_DisableCS(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_MMC_HW_X_IsWriteProtected
*
*  Description:
*    FS low level function. Returns the state of the physical write
*    protection of the SD cards.
*
*  Parameters:
*    Unit      - Device Index
*
*  Return value:
*    1                - the card is write protected
*    ==0              - the card is not write protected
*/
__weak int FS_MMC_HW_X_IsWriteProtected(U8 Unit) {
  FS_USE_PARA(Unit);
  return 0;
}

/*********************************************************************
*
*       FS_MMC_HW_X_SetMaxSpeed
*
*  Description:
*    FS low level function. Sets the SPI interface to a maximum frequency.
*    Make sure that you set the frequency lower or equal but never higher
*    than the given value. Recommended startup frequency is 100kHz - 400kHz.
*
*  Parameters:
*    Unit       - Device Index
*    MaxFreq           - SPI clock frequency in kHz
*
*  Return value:
*    max. frequency    - the maximum frequency set in kHz
*    ==0               - the frequency could not be set
*/

__weak U16 FS_MMC_HW_X_SetMaxSpeed(U8 Unit, U16 MaxFreq) {
  FS_USE_PARA(Unit);
  return MaxFreq;    /* We are not faster than this */
}

/*********************************************************************
*
*       FS_MMC_HW_X_SetVoltage
*
*  Description:
*    FS low level function. Be sure that your card slot si within the given
*    voltage range. Return 1 if your slot can support the required voltage,
*    and if not, return 0;
*
*  Parameters:
*    Unit      - Device Index
*    MaxFreq          - SPI clock frequency in kHz
*
*  Return value:
*    1                - the card slot supports the voltage range
*    ==0              - the card slot does not support the voltage range
*/

__weak int FS_MMC_HW_X_SetVoltage(U8 Unit, U16 Vmin, U16 Vmax) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(Vmin);
  FS_USE_PARA(Vmax);
  return 1;
}

/*********************************************************************
*
*       FS_MMC_HW_X_Read
*
*  Description:
*    FS low level function. Reads a specified number of bytes from MMC
*    card to buffer.
*
*  Parameters:
*    Unit      - Device Index
*    pData            - Pointer to a data buffer
*    NumBytes         - Number of bytes
*
*  Return value:
*    void
*/
__weak void FS_MMC_HW_X_Read (U8 Unit, U8 * pData, int NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_MMC_HW_X_SetDataPointer
*/
__weak void FS_MMC_HW_X_SetDataPointer (U8 Unit, const void * p) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(p);
}

/*********************************************************************
*
*       FS_MMC_HW_X_Write
*
*  Description:
*    FS low level function. Writes a specified number of bytes from
*    data buffer to the MMC/SD card.
*
*  Parameters:
*    Unit      - Device Index
*    pData            - Pointer to a data buffer
*    NumBytes         - Number of bytes
*
*  Return value:
*    void
*/

__weak void FS_MMC_HW_X_Write(U8 Unit, const U8 * pData, int NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_DF_HW_X_Init
*
*  Description:
*    Initialize the hardware before accessing the device.
*
*  Parameters:
*    Unit      - Device Index
*
*  Return Value:
*    == 0      - Hardware successfully intialized
*    != 0      - Error
*/
__weak int FS_DF_HW_X_Init(U8 Unit) {
  FS_USE_PARA(Unit);
  return 0;
}


/*********************************************************************
*
*       FS_DF_HW_X_EnableCS
*
*  Description:
*    Sets the device active using the chip select (CS) line.
*
*  Parameters:
*    Unit      - Device Index
*
*/
__weak void FS_DF_HW_X_EnableCS(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_DF_HW_X_DisableCS
*
*  Description:
*    Sets the device inactive using the chip select (CS) line.
*
*  Parameters:
*    Unit      - Device Index
*
*/
__weak void FS_DF_HW_X_DisableCS(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_DF_HW_X_Read
*
*  Description:
*    Reads a specified number of bytes from device.
*
*  Parameters:
*    Unit             - Device Index
*    pData            - Pointer to a data buffer
*    NumBytes         - Number of bytes
*
*/
__weak void FS_DF_HW_X_Read(U8 Unit, U8 * pData, int NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_DF_HW_X_Write
*
*  Description:
*    Writes a specified number of bytes from data buffer to device.
*
*  Parameters:
*    Unit             - Device Index
*    pData            - Pointer to a data buffer
*    NumBytes         - Number of bytes
*
*/
__weak void FS_DF_HW_X_Write(U8 Unit, const U8 * pData, int NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_NAND_HW_X_EnableCE
*/
__weak void FS_NAND_HW_X_EnableCE(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_NAND_HW_X_DisableCE
*/
__weak void FS_NAND_HW_X_DisableCE(U8 Unit) {
  FS_USE_PARA(Unit);
}


/*********************************************************************
*
*       FS_NAND_HW_X_SetData
*/
__weak void FS_NAND_HW_X_SetDataMode(U8 Unit) {
  FS_USE_PARA(Unit);
}


/*********************************************************************
*
*       FS_NAND_HW_X_SetCmd
*/
__weak void FS_NAND_HW_X_SetCmdMode(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_NAND_HW_X_SetAddr
*/
__weak void FS_NAND_HW_X_SetAddrMode(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_NAND_HW_X_Read_x8
*/
__weak void FS_NAND_HW_X_Read_x8(U8 Unit, void * pData, unsigned NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}


/*********************************************************************
*
*       FS_NAND_HW_X_Write_x8
*/
__weak void FS_NAND_HW_X_Write_x8(U8 Unit, const void * pData, unsigned NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_NAND_HW_X_Init_x8
*/
__weak void FS_NAND_HW_X_Init_x8(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*       FS_NAND_HW_X_Read_x16
*/
__weak void FS_NAND_HW_X_Read_x16(U8 Unit, void * pData, unsigned NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}


/*********************************************************************
*
*       FS_NAND_HW_X_Write_x16
*/
__weak void FS_NAND_HW_X_Write_x16(U8 Unit, const void * pData, unsigned NumBytes) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(pData);
  FS_USE_PARA(NumBytes);
}

/*********************************************************************
*
*       FS_NAND_HW_X_Init_x16
*/
__weak void FS_NAND_HW_X_Init_x16(U8 Unit) {
  FS_USE_PARA(Unit);
}

/*********************************************************************
*
*             FS_NAND_HW_X_WaitTimer
*/
__weak void FS_NAND_HW_X_Delayus(unsigned  Period) {
  int Cnt;
  Cnt = Period * 70;
  do {} while (--Cnt);
}

/*********************************************************************
*
*             FS_NAND_HW_X_WaitWhileBusy
*/
__weak int FS_NAND_HW_X_WaitWhileBusy(U8 Unit, unsigned us) {
  FS_USE_PARA(Unit);
  FS_USE_PARA(us);
  //
  //  This function is called to check the busy pin of
  //  the NAND flash.
  //  When no busy pin is available this function should 
  //  return 1, so the upper layer can check if NAND
  //  flash is busy.
  //
  return 0;
}

/*********************************************************************
*
*       FS_NOR_SPI_HW_X_Init
*
*  Description:
*    Initialize the SPI for use with the flash
*
*  Parameters:
*    Unit      - Device Index
*  
*  Return value:
*    SPI frequency that is set - given in kHz.
*
*/
__weak int FS_NOR_SPI_HW_X_Init(U8 Unit) {
  return 0;
}

/*********************************************************************
*
*       FS_NOR_SPI_HW_X_EnableCS
*
*  Description:
*    Activates chip select signal (CS) of the flash chip.
*
*  Parameters:
*    Unit      - Device Index
*
*  Return value:
*    void
*/
__weak void FS_NOR_SPI_HW_X_EnableCS(U8 Unit) {
}

/*********************************************************************
*
*       FS_MMC_HW_X_DisableCS
*
*  Description:
*    Deactivates chip select signal (CS) of the flash chip.
*
*  Parameters:
*    Unit      - Device Index
*
*  Return value:
*    void
*/
__weak void FS_NOR_SPI_HW_X_DisableCS(U8 Unit) {
}

/*********************************************************************
*
*       FS_NOR_SPI_HW_X_Write
*
*  Description:
*    Reads a specified number of bytes from flash to buffer.
*
*  Parameters:
*    Unit      - Device Index
*    pData     - Pointer to a data buffer
*    NumBytes  - Number of bytes
*
*  Return value:
*    void
*/
__weak void FS_NOR_SPI_HW_X_Read(U8 Unit, U8 * pData, int NumBytes) {
}

/*********************************************************************
*
*       FS_NOR_SPI_HW_X_Write
*
*  Description:
*    Writes a specified number of bytes from data buffer to flash.
*
*  Parameters:
*    Unit      - Device Index
*    pData     - Pointer to a data buffer
*    NumBytes  - Number of bytes
*
*  Return value:
*    void
*/
__weak void FS_NOR_SPI_HW_X_Write(U8 Unit, const U8 * pData, int NumBytes) {
}

/***************************************************
*
*       FS_MCI_HW_GetTransferMem
*
*  Function description
*     Delivers a memory area to be used by the SD-Card controller as transfer.
*     This function delivers the physical address and the virtual address of the tranfer memory.
*     The transfer area needs to be:
*     - Word aligned
*     - Uncached
*     - Have identical virtual and physical addresses
*     - The virtual address of the transfer area must be non-cacheable.
*     Additional requirements are that the memory used is fast enough to not block DMA transfers for too long.
*     In most systems, IRAM is used instead of external SDRAM, since the SDRAM can have relatively long latencies, primarily due to refresh cycles.
*     The size of the memory are is also returned (via pointer). It needs to be at least 512 bytes. In general, bigger values allow higher
*     performance since it allows transfer of multiple sectors without break.
*/
__weak U32 FS_MCI_HW_GetTransferMem(U32 * pPAddr, U32 * pVAddr) {
  return 0;
}

/*************************** End of file ****************************/
